﻿/**
 * Peter
 * Created by: Peter Development Team
 *    http://peter.codeplex.com/
 * 
 * GNU General Public License version 2 (GPLv2)
 *    http://peter.codeplex.com/license
 *
 *  This code is provided on an AS IS basis, with no WARRANTIES,
 *  CONDITIONS or GUARANTEES of any kind.
 *  
 **/

using Peter.Common;
using Peter.Common.MainMenu;
using Peter.Common.Tree;

namespace Peter.Net
{
   /// <summary>
   /// Represents a solution folder item.
   /// </summary>
   public class SolutionFolder : PeterProjectItem
   {
      /// <summary>
      /// Initializes a new solution folder.
      /// </summary>
      /// <param name="parent">Parent.</param>
      /// <param name="projectName"></param>
      public SolutionFolder (ModelTreeViewItem parent, string projectName) : base (parent)
      {
         this.Icon = MainMenuIcon.FolderClose;
         this.Text = projectName;
      }

      /// <summary>
      /// Sets if this is the current project or not.
      /// </summary>
      /// <param name="isCurrent">True if current, false if removing current flag.</param>
      public override void SetCurrentProject (bool isCurrent)
      {
         base.SetCurrentProject (isCurrent);
         if (!isCurrent)
         {
            foreach (var child in this.Children)
            {
               var project = child as PeterProjectItem;
               if (project != null)
                  project.SetCurrentProject (false);
            }
         }
      }
   }
}
